cmake_minimum_required (VERSION 2.8)

project (at-test)
MESSAGE(STATUS "Current path : ${CMAKE_CURRENT_SOURCE_DIR}")

set (CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
set (CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")

include_directories (./at-lib)

aux_source_directory (at-lib SRC_CMODBUS)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${PROJECT_SOURCE_DIR}/,,$(abspath $<))\"'")

# find_library(MY_LIB modbus {CMAKE_CURRENT_SOURCE_DIR}/lib {CMAKE_CURRENT_SOURCE_DIR})
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
add_executable(${PROJECT_NAME} main.cpp ${SRC_CMODBUS})

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)

target_link_libraries(${PROJECT_NAME} serialport pthread)